<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <style>
        .outer {
            width: 500px;
            height: 500px;
            background-color: gray;
        }

        .inner {
            width: 300px;
            height: 300px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class="inner"></div>
    </div>

<script>

    function clickfunc() {
        alert("子")
    }

    document.querySelector(".inner").addEventListener("click", clickfunc)
    document.querySelector(".inner").removeEventListener("click", clickfunc)


</script>
    
</body>
</html>